package com.nova.bluetooth;

import android.content.Intent;
import android.os.Bundle;
import android.view.Gravity;
import android.view.View;
import android.widget.TextView;

import androidx.activity.EdgeToEdge;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;

import com.nova.bluetooth.base.BaseActivity;
import com.nova.bluetooth.databinding.ActivityConfigFunctionBinding;
import com.nova.bluetooth.databinding.ActivityGuideBinding;
import com.nova.bluetooth.mineTest.MainNavActivity;
import com.nova.bluetooth.widget.CommonDialog;

public class GuideActivity extends BaseActivity {

    private ActivityGuideBinding binding;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        EdgeToEdge.enable(this);
        binding = ActivityGuideBinding.inflate(getLayoutInflater());
        setContentView(binding.getRoot());

        initView();
    }

    private void initView(){
        showPolicyDialog();
    }
    private void showPolicyDialog(){
        View dialogView = getLayoutInflater().inflate(R.layout.dialog_show_policy, null);
        CommonDialog dialog = new CommonDialog(this,dialogView);

        TextView tvAgree = dialogView.findViewById(R.id.tv_agree);
        tvAgree.setOnClickListener(v -> {
            dialog.dismissDialog();
            finish();
            startActivity(new Intent(GuideActivity.this,
                    AppMainActivity.class));
        });

        TextView tvDisagree = dialogView.findViewById(R.id.tv_un_agree);
        tvDisagree.setOnClickListener(v -> {
            dialog.dismissDialog();
            finish();
        });

        dialog.setWidth(R.dimen.dp_320);
        dialog.setHeight(R.dimen.dp_370);
        dialog.setCancelable(false);
        dialog.setGravity(Gravity.CENTER);
        dialog.showDialog();
    }
}